using System;
using System.Collections.Generic;
using System.Text;

namespace LumiSoft.Net.Mime.Header
{
    /// <summary>
    /// Represents MIME header field parameter.
    /// </summary>
    public class MIME_HeaderFieldParameter
    {
        private string m_Name  = "";
        private string m_Value = "";

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="name">Parameter name.</param>
        /// <param name="value">Parameter value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>name</b> or <b>value</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public MIME_HeaderFieldParameter(string name,string value)
        {
            if(m_Name == null){
                throw new ArgumentNullException("name");
            }
            if(m_Name == ""){
                throw new ArgumentException("Argument 'name' value must be specified.");
            }
            if(m_Value == null){
                throw new ArgumentNullException("value");
            }

            m_Name  = name;
            m_Value = value;
        }


        #region Properties Implementation

        /// <summary>
        /// Gets parameter name.
        /// </summary>
        public string Name
        {
            get{ return m_Name; }
        }

        /// <summary>
        /// Gets or sets parameter value.
        /// </summary>
        /// <exception cref="ArgumentNullException">Is raised when null value is passed.</exception>
        public string Value
        {
            get{ return m_Value; }

            set{
                if(value == null){
                    throw new ArgumentNullException("value");
                }

                m_Value = value;
            }
        }

        #endregion

    }
}
